package com.css.devops.rest;

import javax.annotation.Resource;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.css.devops.domain.JobBuild;
import com.css.devops.domain.vo.PipelineMonitorQueryCriteria;
import com.css.devops.service.DevopsJobBuild;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Api(tags = "Devops：任务构建信息")
@RestController
@RequestMapping("${devops-context}/jobBuild")
public class DevopsJobBuildResource {

	@Resource(name = "${devops.service.job-build}")
	private DevopsJobBuild devopsJobBuild;
	
	@PostMapping("getJobLastBuild")
	@ApiOperation("最后一次构建详情")
	public ResponseEntity<JobBuild> getJobLastBuild(@RequestBody PipelineMonitorQueryCriteria pipelineMonitorQueryCriteria) {
		JobBuild jobBuild = devopsJobBuild.getJobLastBuild(pipelineMonitorQueryCriteria);
		return ResponseEntity.ok(jobBuild);
	}
}
